﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;

/// <summary>
/// Summary description for ProductDetailViewer
/// </summary>
public class ProductDetailViewer
{
    static CProductFacade facade = new CProductFacade();
    public static Product GetDetail(int productId)
    {
        Product obj = new Product();
        obj = facade.Detail(productId);
        return obj;
    }
    public static string ListImage(Product obj)
    {
        StringBuilder str = new StringBuilder();
        if (obj.Image1.Length > 0)
        {
            str.AppendFormat(_formatListImage, obj.Image1);
        }
        if (obj.Image2.Length > 0)
        {
            str.AppendFormat(_formatListImage, obj.Image2);
        }
        if (obj.Image3.Length > 0)
        {
            str.AppendFormat(_formatListImage, obj.Image3);
        }
        return str.ToString();
    }

    static string _formatListImage = "<a href='#'><img src='{0}' width='105' height='99' /></a>";
    //static string _formatListImage = "<a href='#'><img src='../Admin/Upload/Image/Product/{0}' width='105' height='99' /></a>";
}